<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>cookie</title>
</head>
<body>
    <script>
        /**
         * cookie存储
         * @param c_name key
         * @param value value
         * @param expiredays 过期时间
         * @param domain 存储域名
         */
        function setCookie(c_name,value,expiredays,domain) {
            var exdate=new Date()
            exdate.setDate(exdate.getDate()+expiredays)
            document.cookie=c_name+ "=" +escape(value)+
                ((expiredays==null) ? "" : ";expires="+exdate.toGMTString()) + `;domain=${domain}`
        }

    </script>
</body>
</html>